package es.unex.meigas.gvsig.gui;

import com.iver.cit.gvsig.fmap.layers.CancelationException;
import com.iver.cit.gvsig.fmap.layers.LayerCollectionEvent;
import com.iver.cit.gvsig.fmap.layers.LayerCollectionListener;
import com.iver.cit.gvsig.fmap.layers.LayerPositionEvent;

import es.unex.meigas.core.Meigas;

public class LayersListener implements LayerCollectionListener {

	public LayersListener(){}

	public void layerAdded(LayerCollectionEvent e) {

		// this could be done more elegantly, just adding the new layers...                                                                                                                      
		// but it works fine this way ;-)                                                                                                                                                        
		Meigas.getInputFactory().clearDataObjects();
		Meigas.getInputFactory().createDataObjects();

	}

	public void layerRemoved(LayerCollectionEvent e) {

		Meigas.getInputFactory().clearDataObjects();
		Meigas.getInputFactory().createDataObjects();

	}

	public void layerMoved(LayerPositionEvent e) {}
	public void layerAdding(LayerCollectionEvent e) throws CancelationException {}
	public void layerMoving(LayerPositionEvent e) throws CancelationException {}
	public void layerRemoving(LayerCollectionEvent e) throws CancelationException {}
	public void visibilityChanged(LayerCollectionEvent e) throws CancelationException {}

}



